package com.codetree.strategy.simple.switch_example;

import com.codetree.strategy.common.Constant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Slf4j
@Service
public class SwitchPaymentServiceImpl implements SwitchPaymentService {
    @Override
    public String pay(String type, BigDecimal amount) {

        switch (type) {
            case Constant.PAYConstant.ALI_PAY:
                return "支付宝支付成功，金额：" + amount;
            case Constant.PAYConstant.WECHAT_PAY:
                return "微信支付成功，金额：" + amount;
            case Constant.PAYConstant.UNION_PAY:
                return "银联支付成功，金额：" + amount;
            default:
                throw new IllegalArgumentException("无效支付方式");
        }
    }
}
